Skip to content

feat(docs): docs MCP at cloudhal.dev/mcp and Accept: text/markdown (RFC-0037 phase 3) - #37

Merged
Madraka merged 1 commit into
mainfrom
feat/docs-mcp
Oct 21, 2026
Merged

Madraka merged 1 commit into
mainfrom
feat/docs-mcp

Conversation

@Madraka

@Madraka Madraka commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Builds on #36 (merged).

What

  • https://cloudhal.dev/mcp: a standalone, read-only, unauthenticated docs MCP in the cloudhal-dev Worker (apps/docs/src/worker). Streamable HTTP, stateless (no session id, no SSE; GET/DELETE → 405), protocol versions 2024-11-05 … 2025-11-25.
    • search_docs({ query, section? }) → up to 8 { title, url, snippet } (also as structuredContent with an outputSchema);
    • read_doc({ url }) → the page's Markdown; only cloudhal.dev URLs or site paths.
    • Rate limited to 100 requests/min per IP (ratelimits binding MCP_RATE_LIMITER, 429 + Retry-After).
  • Search index built in scripts/postbuild.ts from the same page list (src/lib/pages.ts) → /_mcp/search-index.json (~2.2 MB, loaded once per isolate). BM25 with title/description/path boosts and prefix matches; snippets centre on the densest cluster of query words.
  • Accept: text/markdown on any page answers its .md copy with Vary: Accept and x-markdown-tokens; page HTML gets Vary: Accept; everything else goes to the assets binding unchanged (run_worker_first: true).
  • ADR-0039 rule 4 / RFC-0037 §4 amended (2026-10-21): no docs tools in the site MCP (cloudhal mcp / remote /mcp). Reasons are recorded there. The site server's instructions get one line naming https://cloudhal.dev/llms.txt (changeset: @cloudhal/mcp-server patch).
  • docs/agents/docs-for-agents.md: how to add the docs MCP to Claude Code, Codex, Cursor, VS Code and Claude Desktop (no auth), and why it is separate from the site MCP.

Checks

  • pnpm --filter @cloudhal/docs test (33, incl. new test/worker.test.ts, no network), typecheck, build
  • pnpm --filter @cloudhal/mcp-server test (140)
  • biome check, size:check
  • wrangler dev: initialize, notifications/initialized → 202, tools/list, search_docs, read_doc, GET → 405, Markdown negotiation headers; plus the official @modelcontextprotocol/client (Streamable HTTP transport) connecting, listing, searching and reading.

Not deployed. Before the first deploy, check that wrangler deploy accepts the ratelimits namespace id 1039 on the account.

🤖 Generated with Claude Code

…FC-0037 phase 3)

The cloudhal-dev Worker gets a small script in front of the assets:

- /mcp: a standalone, read-only, unauthenticated docs MCP (Streamable
  HTTP, stateless, JSON answers) with search_docs and read_doc, rate
  limited to 100 requests a minute per IP (MCP_RATE_LIMITER);
- Accept: text/markdown on a page answers its .md copy with Vary:
  Accept and x-markdown-tokens; everything else goes to the assets
  binding unchanged.

postbuild.ts writes the search index from the same page list as the
HTML, the .md copies and llms.txt; the Worker ranks with BM25 and
prefix matches. Sections move to src/lib/sections.ts.

ADR-0039 rule 4 and RFC-0037 §4 are amended: the site MCP server
(cloudhal mcp, remote /mcp) gets no docs tools. It serves agents working
on sites, its how-to knowledge lives in skills, tool descriptions and
server instructions, and docs tools would add irrelevant tools for
narrow keys, a second knowledge source and an outbound dependency. Its
instructions now only name https://cloudhal.dev/llms.txt.

docs/agents/docs-for-agents.md explains how to add the docs MCP to
Claude Code, Codex, Cursor, VS Code and Claude Desktop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Madraka <8898640+Madraka@users.noreply.github.com>
@Madraka
Madraka changed the base branch from docs/start-and-agents to main October 21, 2026 07:44
@Madraka
Madraka merged commit 362e4ff into main Oct 21, 2026
4 checks passed
@Madraka Madraka mentioned this pull request Oct 21, 2026
@Madraka
Madraka deleted the feat/docs-mcp branch October 21, 2026 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant